package basic_practice_1020;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main2 {
//https://zh.wikipedia.org/wiki/%E9%94%99%E6%8E%92%E9%97%AE%E9%A2%98
	public static void main(String[] args) throws IOException {
		BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
		long[]A=new long[21];
		A[0]=0;
		A[1]=0;
		A[2]=1;
		for(int i=3,flag=-1;i<21;i++,flag*=-1) {
			A[i]=i*A[i-1]+flag;
		}
		String string=null;
		while((string=reader.readLine())!=null) {
			if(!string.isEmpty()) {
				int n=Integer.parseInt(string);
				System.out.println(A[n]);
			}
		}
	}
}
